###############################################################################
#
# Call other makefiles with make -f
#
# Copyright 2010 Nintendo.  All rights reserved.
#
# These coded instructions, statements, and computer programs contain
# proprietary information of Nintendo of America Inc. and/or Nintendo
# Company Ltd., and are protected by Federal copyright law.  They may
# not be disclosed to third parties or copied or duplicated in any form,
# in whole or in part, without the prior written consent of Nintendo.
#
###############################################################################

.PHONY: default headers install clean clobber

default: headers install

MAKE_FILES := makefile.mk

###############################################################################
#
#  headers
#
###############################################################################

# once is enough (same behavior for all)
headers:
	@$(MAKE) -f $(firstword $(MAKE_FILES)) headers --no-print-directory

###############################################################################
#
#  install
#
###############################################################################

MAKE_INSTALL_FILES_TARGET := $(addprefix install_,$(MAKE_FILES))

.PHONY: $(MAKE_INSTALL_FILES_TARGET)

$(MAKE_INSTALL_FILES_TARGET):
	@$(MAKE) -f $(subst install_,,$@) install --no-print-directory

install: $(MAKE_INSTALL_FILES_TARGET)

###############################################################################
#
#  clean
#
###############################################################################

# once is enough (same behavior for all)
clean:
	@$(MAKE) -f $(firstword $(MAKE_FILES)) clean --no-print-directory

###############################################################################
#
#  clobber
#
###############################################################################

MAKE_CLOBBER_FILES_TARGET := $(addprefix clobber_,$(MAKE_FILES))

.PHONY: $(MAKE_CLOBBER_FILES_TARGET)

$(MAKE_CLOBBER_FILES_TARGET):
	@$(MAKE) -f $(subst clobber_,,$@) clobber --no-print-directory

clobber: $(MAKE_CLOBBER_FILES_TARGET)
